From 198c3c61a9bf715ec4c7329ccc6ef4c351205667 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 3 Jan 2007 20:40:30 +0000 Subject: [PATCH] If the current page is removed, always pick a different one. (#392457, 2007-01-03 Matthias Clasen * gtk/gtkassistant.c (remove_page): If the current page is removed, always pick a different one. (#392457, Colin Watson) svn path=/trunk/; revision=17037 --- ChangeLog | 6 ++++++ gtk/gtkassistant.c | 23 ++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f51c9bf7f4..0188d047bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-03 Matthias Clasen + + * gtk/gtkassistant.c (remove_page): If the current page + is removed, always pick a different one. (#392457, + Colin Watson) + 2007-01-03 Matthias Clasen * modules/printbackend/cups/*.c: Coding style cleanups. diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index 4dc89885bf..49a519dba7 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -849,12 +849,29 @@ remove_page (GtkAssistant *assistant, { GtkAssistantPrivate *priv = assistant->priv; GtkAssistantPage *page_info; + GList *page_node; page_info = element->data; - /* If we are mapped and visible, we want to deal with changing the page. */ - if ((GTK_WIDGET_MAPPED (page_info->page)) && (page_info == priv->current_page)) - compute_next_step (assistant); + /* If this is the current page, we need to switch away. */ + if (page_info == priv->current_page) + { + if (!compute_next_step (assistant)) + { + /* The best we can do at this point is probably to pick the first + * visible page. + */ + page_node = priv->pages; + + while (page_node && !GTK_WIDGET_VISIBLE (((GtkAssistantPage *) page_node->data)->page)) + page_node = page_node->next; + + if (page_node) + priv->current_page = page_node->data; + else + priv->current_page = NULL; + } + } priv->pages = g_list_remove_link (priv->pages, element); priv->visited_pages = g_slist_remove_all (priv->visited_pages, page_info); -- 2.30.2